
import csv

csv_file_name = 'twitter_users.csv'


def get_all_users():
    csvFile = open(csv_file_name)
    cs = list(csv.reader(csvFile))
    return cs


def add_user(user):
    with open (csv_file_name,'a+') as f:
        csvFile = csv.writer(f)
        csvFile.writerow(user)
    
def save_to_csv(list,filename):
    csvFile = open(filename, "w")
    writer = csv.writer(csvFile)
    writer.writerows(list)
    csvFile.close()

def delete_uid(uid):
    csvFile = open(csv_file_name)
    cs = list(csv.reader(csvFile))
    for line in cs :
        if line[0] == uid:
            cs.remove(line)
    save_to_csv(cs,csv_file_name)
